package dbExec

import (
	"reflect"
)

type HotSqlEr interface {
	ReadFileAble() any
	ReadTableAble() any
	PlayBackAble(v any) any
}
type ReadFile struct {
	RowsSplistFay string   `json:"rowsS"`
	FileName      []string `json:"fileName"`
	Curry         int      `json:"curry"`
}

type HotSqlInput struct {
	Type string
	File ReadFile `json:"file"`
}

func HotSqlInit(hs HotSqlInput) (t HotSqlEr) {
	mutex.Lock()
	defer mutex.Unlock()
	if v1, ok := dbTypeInterFuncRef[hs.Type]; ok {
		if v1.Kind() == reflect.Func {
			args := []reflect.Value{
				reflect.ValueOf(hs),
				//reflect.ValueOf(hotSqlApi[hs.Type]),
			}
			i := v1.Call(args)
			for ii := 0; ii < len(i); ii++ {
				t = i[ii].Interface().(HotSqlEr)
			}
		}
	}
	return
}
